<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!-- 
        粘性定位  position: sticky; 通过left right bottom top进行位置偏移
             相对定位和固定定位  一般用来做吸顶效果   css3.0新增的有兼容性
     -->
     <style>
         *{padding:0; margin:0;}
         .header{
             width:1600px; height:100px; background: pink;
         }
         .nav{
             width:1000px; height:60px; background: red;
             margin:0 auto;
             position: sticky;
             top:0;
         }
         .main{
             width:1600px; height:800px; background: green;
         }
         .footer{
             width:1600px; height:100px; background: #000;
         }
     </style>
</head>
<body>
    <div class="header"></div>
    <div class="nav"></div>
    <div class="main"></div>
    <div class="footer"></div>
</body>
</html>